package com.guanghua.brick.util;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;


/**
 * 装载spring bean的工具类
 * @author leeon
 */
public class SpringBeanUtil {
	private static BeanFactory factory = null;
	private static final String[] CONTEXT_PATH = {"/brick.spring.biz.xml", "/brick.spring.db.xml"};
	
	public static BeanFactory getBeanFactory() {
		if (factory == null) {
			factory = new ClassPathXmlApplicationContext(CONTEXT_PATH);
		}
		return factory;
	}
	
	public static void refresh() {
		factory = new ClassPathXmlApplicationContext(CONTEXT_PATH);
	}
}
